<?php
namespace app\api\controller\food;

use hema\wechat\Pay as Wxpay;
use hema\alipay\Driver as Alipay;
use app\api\model\food\Order as OrderModel;
use app\api\model\food\Record as RecordModel;
use app\api\model\food\User as UserModel;
use app\api\model\food\Shop as ShopModel;


/**
 * 支付成功异步通知接口
 */
class Notify
{
    //****************** 微信支付回调 **************************
    /**
     * 订单支付- 直连商户
     */
    public function order($appletid='')
    {
		$wxpay = new Wxpay([]);
        $wxpay->notify(new OrderModel,$appletid);
    }
    /**
     * 订单退款
     */
    public function orderRefund($appletid='')
    {
        $wxpay = new Wxpay([]);
        $wxpay->refundsNotify(new OrderModel,$appletid);
    }
    /**
     * 会员充值
     */
    public function recharge($appletid='')
    {
        $wxpay = new Wxpay([]);
        $wxpay->notify(new RecordModel,$appletid,'add');
    }
    
    /**
     * 购买会员卡
     */
    public function buyvip($appletid='')
    {
        $wxpay = new Wxpay([]);
        $wxpay->notify(new UserModel,$appletid,'add');
    }
    
    /**
     * 线上买单
     */
    public function paybill($appletid='')
    {
        $wxpay = new Wxpay([]);
        $wxpay->notify(new ShopModel,$appletid,'add');
    }
    //****************** 支付宝支付回调 **************************
    
    /**
     * 订单支付- 直连商户
     */
    public function alipayOrder($appletid='')
    {
		$alipay = new Alipay($appletid);
        $alipay->notify(new OrderModel);
    }
    /**
     * 订单退款
     */
    public function alipayOrderRefund($appletid='')
    {
        $alipay = new Alipay($appletid);
        $alipay->refundsNotify(new OrderModel);
    }
    /**
     * 会员充值
     */
    public function alipayRecharge($appletid='')
    {
        $alipay = new Alipay($appletid);
        $alipay->notify(new RecordModel,'add');
    }
    
    /**
     * 购买会员卡
     */
    public function alipayBuyvip($appletid='')
    {
        $alipay = new Alipay($appletid);
        $alipay->notify(new UserModel,'add');
    }
    
    /**
     * 线上买单
     */
    public function alipayPaybill($appletid='')
    {
        $alipay = new Alipay($appletid);
        $alipay->notify(new ShopModel,'add');
    }

}
